function fetchData(tableid) {
  // alert(1)
  // console.log(1)
  $.ajax({
    url: 'http://127.0.0.1:8080/wineapi/orderallinfo',
    dataType: 'json',
    type: 'get',
    data: {
      tableid: tableid
    },
    success: function (data) {
      var output = ''
      if (data.code == "ok") {
        var orderdata = data.data;
        if (orderdata[0].status == 0) {
          var myAuto = document.getElementById('myaudio');
          myAuto.play();
        }
        document.getElementById('total').innerText = '总价: ' + orderdata[0].total

        console.log(orderdata)
        output += orderdata.map((v) => {
          return (
            `
            <tr class="" style="height:80pxs">
              <th width="100"><img src="${v.wimg}" style="width:80px;height:80px"></th>
              <th style="line-height:80px">${v.winename}</th>
              <th style="line-height:80px">${v.num}</th>
              <th style="line-height:80px">${v.wprice}</th>
              <th style="line-height:80px">${v.date}</th>
            </tr>
            `
          )
        })
        $('#tbody').html(output)
      }
    },
    error: function (err) {
      console.log('err', err)
    }
  })
}

function modifyData(tableid) {
  // alert(1)
  // console.log(2)
  $.ajax({
    url: 'http://127.0.0.1:8080/wineapi/orderupdate',
    dataType: 'json',
    type: 'get',
    data: {
      tableid: tableid
    },
    success: (data) => {
      if (data.code == "ok") {
        var submit = document.getElementById('submit')
        var panelheader = document.getElementById('panelheader')

        //修改订单状态
        submit.setAttribute('class', 'button border-gray')
        submit.setAttribute('disabled', 'disabled')
        submit.innerText = '已确认'
        panelheader.setAttribute('class', 'panel-head  border-gray bg-gray')
        alert('订单已确认')

      }
    },
    error: function (err) {
      console.log('err', err)
    }
  })
  return code
}